package com.cxyd.modules.log.controller;

import com.cxyd.common.page.PageData;
import com.cxyd.common.utils.Result;
import com.cxyd.modules.log.service.SysLogLoginService;
import com.cxyd.modules.log.dto.SysLogLoginDTO;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.Map;

/**
 * 登录日志
 */
@RestController
@RequestMapping("sys/log/login")
public class SysLogLoginController {
    private final SysLogLoginService sysLogLoginService;

    public SysLogLoginController(SysLogLoginService sysLogLoginService) {
        this.sysLogLoginService = sysLogLoginService;
    }

    @GetMapping("page")
    @RequiresPermissions("sys:log:login")
    public Result<PageData<SysLogLoginDTO>> page(@RequestParam Map<String, Object> params){
        PageData<SysLogLoginDTO> page = sysLogLoginService.page(params);

        return new Result<PageData<SysLogLoginDTO>>().ok(page);
    }
}